package com.itheima.advice;

import com.itheima.pojo.MyResponseResult;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class MyControllerAdvice {
    @ExceptionHandler(Exception.class)
    public MyResponseResult<String> doMyException(Exception e){
        //记录日志
        e.printStackTrace();
//        安抚用户
        return MyResponseResult.error("亲，不要慌，服务器正在升级中");
    }
}
